#!/bin/csh
#Plot 2-D velocity and standard error by GMT from files anomaly.*.grd1 and stdde.*.grd1
 
#   cp ../../phase-coeff-*s.dat .
#    cp ../../nodecoeff* .  
#   set bds=-120/-106/22/35
   set bds=-126/-109/31/40
#--------------------------velocity coefficients --------------------------
#makecpt -Crainbow -I -T3.1/4.0/.1 -Z >! anomaly.cpt
makecpt -Crainbow -I -T3.6/4.0/.1 -Z >! anomaly3.cpt
# makecpt -Crainbow -I -T-0.5/0.5/.1 -Z >! anomaly.cpt 

#***************************************
#foreach file (`ls phase-coeff-*s.dat`)
#set fn1=`echo $file | sed 's/.dat//' `
#xyz2grd -R$bds -I.5 $fn1.dat -G$fn1.grd2
#psbasemap -R$bds -JM5.5i -Ba2f2  -Y1.15 -K -P >! $fn1.ps
#grdimage $fn1.grd2 -R$bds -Canomaly.cpt -JM5.5i -Ba2f2 -K -O -P >> $fn1.ps
#grdcontour $fn1.grd2 -C.5 -JM5.5i -Ba2f2 -K -O -P >> $fn1.ps
#pscoast -R$bds -Dl -A250 -JM5.5i  -W1p -Na -K -O -P >> $fn1.ps
#psscale -D2.5i/7i/5.5i/.25ih -B0.2 -Canomaly.cpt -O -P >> $fn1.ps
#end
#rm *grd2 *~ anomaly.cpt 


#--------------------------velocity 0.2x0.2--------------------------

#./gridgen < phase-coeff-22s.dat > phasevel22s.dat
#./gridgen < phase-coeff-25s.dat > phasevel25s.dat
#./gridgen < phase-coeff-29s.dat > phasevel29s.dat
#./gridgen < phase-coeff-33s.dat > phasevel33s.dat
#./gridgen < phase-coeff-40s.dat > phasevel40s.dat
#./gridgen < phase-coeff-46s.dat > phasevel46s.dat
#./gridgen < phase-coeff-50s.dat > phasevel50s.dat
#./gridgen < phase-coeff-59s.dat > phasevel59s.dat
#./gridgen < phase-coeff-67s.dat > phasevel67s.dat
#./gridgen < phase-coeff-77s.dat > phasevel77s.dat
#./gridgen < phase-coeff-91s.dat > phasevel91s.dat
#./gridgen < phase-coeff-100s.dat > phasevel100s.dat
#./gridgen < phase-coeff-111s.dat > phasevel111s.dat
#./gridgen < phase-coeff-125s.dat > phasevel125s.dat
#./gridgen < phase-coeff-143s.dat > phasevel143s.dat

#./gridgen < nodecoeff10.80.16 > phasevel16s.dat

#makecpt -Crainbow -I -T3.6/4.3/.1 >! anomaly.cpt
  

#***************************************
#foreach file (`ls phasevel*s.dat`)
#foreach file (`ls vel_change*s.grd`)
#set fn1=`echo $file | sed 's/.grd//' `
set fn1 = 'gridphse.030.590.40.120.25.dec.map'
xyz2grd -R$bds -I.25 $fn1 -G$fn1.grd2
#xyz2grd -R$bds -I.25 $fn1.grd -G$fn1.grd2
#psbasemap -R$bds -JM5.5i -Ba2f2  -Y1.15 -K -P >! $fn1.ps
psbasemap -R$bds -JM5.5i -Ba2f2  -Y4.15 -K -P >! $fn1.ps
pstext -R$bds -JM5.5i -O -K -P -N <<EOI >> $fn1.ps
-120 41.5 12 0 0.5 5 $fn1
-121.5 27.3 14 0 0.5 5 Phase Velocity     km/s
EOI
psscale -D2.7i/-0.6i/5.5i/.25ih -B0.1 -Canomaly3.cpt -O -P -K >> $fn1.ps
#psclip -R$bds -JM5.5i -O -K -P  <<EOI >> $fn1.ps
# -126.0 38.0
# -120.0 31.0
# -109.5 31.0
# -109.5 40.0
# -126.0 40.0
# -126.0 38.0
#EOI
grdimage $fn1.grd2 -R$bds -Canomaly3.cpt -JM5.5i -Ba2f2 -K -O -P >> $fn1.ps
#grdcontour $fn1.grd2 -C.1 -JM5.5i -Ba2f2 -K -O -P >> $fn1.ps
pscoast -R$bds -Dl -A250 -JM5.5i  -W1p -Na -K -O -P >> $fn1.ps
#psxy BRrgnlBndryPts2.gmt -R$bds -JM5.5i -N -M -W2/0to -O -K -P >> $fn1.ps
#psxy staloclist.dat -R$bds -JM5.5i -Sc0.2c -G0/0/0 -N  -O -K -P >> $fn1.ps
psxy SampleLoc.dat -R$bds -JM5.5i -Sc0.1c -G0/0/0 -N -: -O -K -P >> $fn1.ps
#  next two plot aniso vectors
psxy anisoout.030.590.40.120.25.decamp -R$bds -JM5.5i -W -SV0.03/0/0 -O -K -P >> $fn1.ps
psxy anisoout.030.590.40.120.25.deccir -R$bds -JM5.5i -W -Sc -O -K -P >> $fn1.ps

#psscale -D2.5i/7i/5.5i/.25ih -B0.2 -Canomaly3.cpt -O -P >> $fn1.ps
#end


#rm *grd2 *~ anomaly1.cpt 
